<title>Simjamkesda Berau</title>
<?php 
	include ('../../config/koneksi.php');
	include ('../../config/fungsi_tgl_indo.php');
	include ('../../config/library.php');
	
	$pejabat = mysql_fetch_array(mysql_query("select * from setting where id_setting = 2"));
?>
	<link href="../../asset/css/style_kartu.css" rel="stylesheet" type="text/css">
	<link href="../../asset/css/cetak.css" rel="stylesheet" type="text/css">
<?php
	if($_GET['jns'] == 1){
		$id=$_GET['id'];
		cetak_barcode($id);
		$tgl = tgl_indonesia(date("Y-m-d"));
		$sql=mysql_query("select id_jaminan, p.id_peserta, nama, tempat_lahir, tgl_lahir, jenis_peserta,ja.tgl_mulai, ja.tgl_selesai, id_jaminan_sebelumnya, jenis_kunjungan, catatan_kunjungan, pn.jk from jaminan ja inner join peserta p on ja.id_peserta = p.id_peserta inner join penduduk pn on p.id_penduduk = pn.id_penduduk inner join jenis_peserta j on p.id_jenis_peserta = j.id_jenis_peserta inner join jenis_kunjungan jn on jn.id_jenis_kunjungan = ja.id_jenis_kunjungan inner join catatan_kunjungan c on ja.id_catatan_kunjungan = c.id_catatan_kunjungan where id_jaminan='$id'");

		$hasil = mysql_fetch_array($sql);
	?>
		<div id="cetak">
			<table width="730" align="center">
				<tr>
					<td colspan="6" align="center">
						<img src="../../asset/images/header.jpg" width="730">
					</td>
				</tr>
				<tr>
					<td colspan="6" align="center"><b>SURAT JAMINAN PELAYANAN PESERTA JAMINAN KESEHATAN DAERAH BERAU</b></td>
				</tr>
				<tr>
					<td colspan="6" align="center">
						<?php
							if($hasil['tgl_input'] == $hasil['tgl_mulai'] && $hasil['tgl_input'] == $hasil['tgl_selesai']){
								echo "<b>Berlaku : 1 (Satu) Kali Kunjungan</b>";
							}else{
								echo "<b>Berlaku : ".tgl_ind1($hasil['tgl_mulai'])." s.d. ".tgl_ind1($hasil['tgl_selesai'])."</b>";
							}
						?>
					</td>
				</tr>
				<tr>
					<td colspan="6" align="right">
						<span id="id_jaminan"><?php echo "*$hasil[id_jaminan]*"; ?></span>
					</td>
				</tr>
				<tr>
					<td colspan="6" align="center">&nbsp;</td>
				</tr>
				<tr>
					<td width="150">No. Kartu Jamkesda</td>
					<td width="5">:</td>
					<td width="300"><?php echo $hasil['id_peserta']; ?></td>
					<td width="120">No. SJP</td>
					<td width="5">:</td>
					<td width="150"><?php echo $hasil['id_jaminan']; ?></td>
				</tr>
				<tr>
					<td>Nama Peserta</td>
					<td>:</td>
					<td><?php echo $hasil['nama']; ?></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td>Tempat, Tgl Lahir</td>
					<td>:</td>
					<td><?php echo $hasil['tempat_lahir'].", ".tgl_ind1($hasil['tgl_lahir']); ?></td>
					<td>Jenis Kelamin</td>
					<td>:</td>
					<td>
						<?php
							if($hasil['jk'] == 'L'){
								echo "Laki-laki";
							}else{
								echo "Perempuan";
							}
						?>
					</td>
				</tr>
				<tr>
					<td>Jenis Kunjungan</td>
					<td>:</td>
					<td><?php echo $hasil['jenis_kunjungan']; ?></td>
					<td>Asal Peserta</td>
					<td>:</td>
					<td><?php echo $hasil['jenis_peserta']; ?></td>
				</tr>
				<tr>
					<td>Catatan Kunjungan</td>
					<td>:</td>
					<td><?php echo $hasil['catatan_kunjungan']; ?></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td></td>
					<td></td>
					<td></td>
					<td colspan="3" align="center">Berau, <?php echo tgl_indonesia($hasil['tgl_mulai']); ?></td>
				</tr>
				<tr>
					<td colspan="3">Catatan :</td>
					<td colspan="3" align="center"><?php echo $pejabat['jabatan']; ?></td>
				</tr>
				<tr>
					<td colspan="3">1. Ruang Rawat Inap Kelas III</td>
					<td colspan="3" align="center"></td>
				</tr>
				<tr>
					<td colspan="3">2. Tidak berlaku untuk Rumah Sakit yang tidak memiliki hubungan kerjasama.</td>
					<td colspan="3" align="center"></td>
				</tr>
				<tr>
					<td colspan="3" align="center"></td>
					<td colspan="3" align="center"><?php echo $pejabat['nama']; ?></td>
				</tr>
			</table>
		</div>
<?php
	}else{
		$id=$_GET['id'];
		$tgl = tgl_indonesia(date("Y-m-d"));
		$sql=mysql_query("select ja.id_jaminan, p.id_peserta, nama, pn.jk, tempat_lahir, tgl_lahir, jenis_peserta,ja.tgl_mulai, ja.tgl_selesai, id_jaminan_sebelumnya, jenis_kunjungan, catatan_kunjungan, jr.diagnosa_awal, kp.kelas_perawatan, r.ruang ,jr.id_ritl, jr.no_mr, jr.diagnosa_keluar, jr.catatan_khusus from jaminan ja inner join peserta p on ja.id_peserta = p.id_peserta inner join penduduk pn on p.id_penduduk = pn.id_penduduk inner join jenis_peserta j on p.id_jenis_peserta = j.id_jenis_peserta inner join jenis_kunjungan jn on jn.id_jenis_kunjungan = ja.id_jenis_kunjungan inner join catatan_kunjungan c on ja.id_catatan_kunjungan = c.id_catatan_kunjungan inner join jaminan_ritl jr on jr.id_jaminan = ja.id_jaminan inner join kelas_perawatan kp on kp.id_kelas_perawatan = jr.id_kelas_perawatan inner join ruang r on r.id_ruang = jr.id_ruang_perawatan where ja.id_jaminan='$id'");

		$hasil = mysql_fetch_array($sql);
	?>
	<div id="cetak">
		<table border="0" width="740" align="center">
			<tr>
				<td colspan="6" align="center">
					<img src="../../asset/images/header.jpg" width="740">
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center"><b>SURAT JAMINAN PELAYANAN PESERTA JAMINAN KESEHATAN DAERAH BERAU<br>Jaminan Akhir Rawat Inap</b></td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<?php
						if($hasil['tgl_input'] == $hasil['tgl_mulai'] && $hasil['tgl_input'] == $hasil['tgl_selesai']){
							echo "<b>Berlaku : 1 (Satu) Kali Kunjungan</b>";
						}else{
							echo "<b>Berlaku : ".tgl_ind1($hasil['tgl_mulai'])." s.d. ".tgl_ind1($hasil['tgl_selesai'])."</b>";
						}
					?>
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center"></td>
			</tr>
			<tr>
				<td colspan="2" align="right">
					<span id="id_jaminan"><?php echo "*$hasil[id_jaminan]*"; ?></span>
				</td>
			</tr>
			<tr>
				<td valign="top">
					<table>
						<tr>
							<td width="170">No. Kartu Jaminan</td>
							<td width="5">:</td>
							<td width="250"><?php echo $hasil['id_jaminan']; ?></td>
						</tr>
						<tr>
							<td>Nama Peserta</td>
							<td>:</td>
							<td><?php echo $hasil['nama']; ?></td>
						</tr>
						<tr>
							<td>Tempat, Tgl Lahir</td>
							<td>:</td>
							<td><?php echo $hasil['tempat_lahir'].", ".tgl_ind1($hasil['tgl_lahir']); ?></td>
						</tr>
						<tr>
							<td>Jenis Kelamin</td>
							<td>:</td>
							<td>
								<?php
									if($hasil['jk'] == 'L'){
										echo "Laki-laki";
									}else{
										echo "Perempuan";
									}
								?>
							</td>
						</tr>
						<tr>
							<td>No MR</td>
							<td>:</td>
							<td><?php echo $hasil['no_mr']; ?></td>
						</tr>
						<tr>
							<td>Diagnosa Awal</td>
							<td>:</td>
							<td><?php echo $hasil['diagnosa_awal']; ?></td>
						</tr>
						<tr>
							<td>Hak Kls Perawatan</td>
							<td>:</td>
							<td><?php echo $hasil['kelas_perawatan']; ?></td>
						</tr>
						<tr>
							<td>Ruang Perawatan</td>
							<td>:</td>
							<td><?php echo $hasil['ruang']; ?></td>
						</tr>
						<tr>
							<td>Asal Peserta</td>
							<td>:</td>
							<td><?php echo $hasil['jenis_peserta']; ?></td>
						</tr>
					</table>
				</td>
				<td valign="top">
					<table>
						<tr>
							<td width="150">No. Kartu Jamkesda</td>
							<td width="5">:</td>
							<td width="250"><?php echo $hasil['id_peserta']; ?></td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td></td>
							<td></td>
						</tr>
						<tr>
							<td>Perawatan</td>
							<td>:</td>
							<td></td>
						</tr>
						<tr>
							<td colspan="3">
								<table border="1" width="100%" class="tabel2">
									<tr>
										<th>Ruang Perawatan</th>
										<th>Tgl Masuk</th>
										<th>Tgl Keluar</th>
									</tr>
									<?php
										$ruang = mysql_query("select * from perawatan p inner join ruang r on p.id_ruang = r.id_ruang where id_ritl = $hasil[id_ritl]");
										while($r = mysql_fetch_array($ruang)){
										echo "<tr>
												<td>$r[ruang]</td>
												<td align=center>".tgl_ind1($r['tgl_masuk'])."</td>
												<td align=center>".tgl_ind1($r['tgl_keluar'])."</td>
											</tr>";
										}
									?>
								</table>
							</td>
						</tr>
						<tr>
							<td>Diagnosa Keluar</td>
							<td>:</td>
							<td><?php echo $hasil['diagnosa_keluar']; ?></td>
						</tr>
						<tr>
							<td>Catatan Khusus</td>
							<td>:</td>
							<td><?php echo $hasil['catatan_khusus']; ?></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td colspan="2">
				<table width="100%">
					<tr>
						<td align="center">&nbsp;</td>
						<td align="center"></td>
						<td align="center"></td>
					</tr>
					<tr>
						<td align="center">Peserta</td>
						<td align="center"><?php echo $pejabat['jabatan'];?></td>
						<td align="center">Verifikator Jamkesda</td>
					</tr>
					<tr>
						<td align="center">&nbsp;</td>
						<td align="center"></td>
						<td align="center"></td>
					</tr>
					<tr>
						<td align="center">&nbsp;</td>
						<td align="center"></td>
						<td align="center"></td>
					</tr>
					<tr>
						<td align="center"><?php echo $hasil['nama']; ?></td>
						<td align="center"><?php echo $pejabat['nama'];?></td>
						<td align="center">(........................................)</td>
					</tr>
				</table>
				</td>
			</tr>
		</table>
	</div>
<?php
	}
?>